package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.constant.XiuxianConstants;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "骗骗花")
@Order(1006)
@Component
public class PianPianHua extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;

        int orgAtk = first.getBattleInfo().getSpell();
        int def = second.getBattleInfo().getRes();
        int atk = (int) (orgAtk * 1.5);
        dmg = battleHelper.calAtk(atk, def);
        //user.getElement().get("土") < XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY
        if(first.getUserBO().getElement().get("火") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("炽锋刃","火焰弹","火蕊繁星","烈焰凝聚","火焰迫击炮"));
        }else if(first.getUserBO().getElement().get("水") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("霜叶刃","霜棘","寒冰凝聚","冰弹机关枪"));
        }else if(first.getUserBO().getElement().get("金") > XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY){
            desc = RandomUtil.choice(Lists.newArrayList("电光刃","球状闪电","雷电凝聚","雷霆狙击枪"));
        }else {
            desc = RandomUtil.choice(Lists.newArrayList("元素叶刃","元素凝聚","元素射线"));
        }
        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习妖兽的攻击手段");
    }

    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return  "古灵精怪的拟态植物魔物，会用元素战斗。\n" +
                "有时会隐藏在地表下，捕猎浑然不觉的猎物。如果有足够的年月、养分与环境，或许能扎根某处，长成巨大的、摇曳着喷吐魔力的树\n\n" +
                "擅长法术攻击,不同的元素沾染会拥有不同的技能组\n 元素叶刃,元素凝聚,元素射线\n" +
                "出没地点：\t荻花洲，归离原，渌华池" ;
    }


}
